From 6d54f5795fc7c67e478143de1ab4e479bf593393 Mon Sep 17 00:00:00 2001 From: Stevan Earl Date: Tue, 11 Aug 2026 15:32:42 -0700 Subject: [PATCH] feat: define the NONE no-focal AnimID --- conversion/clean.sql | 42 +++++++++++++++++++ .../sokwedb/tables/create/biography_data.m4 | 1 + doc/src/tables/biography_data.m4 | 19 +++++---- doc/src/views/biography.m4 | 7 +++- include/global_constants.m4 | 2 + 5 files changed, 61 insertions(+), 10 deletions(-) diff --git a/conversion/clean.sql b/conversion/clean.sql index 39d38d3..f233d56 100644 --- a/conversion/clean.sql +++ b/conversion/clean.sql @@ -140,6 +140,48 @@ UPDATE biography SET b_sex = 'M' WHERE b_animid = 'UNK'; +-- Provide the code used when it does not make sense to record an individual. +INSERT INTO biography ( + b_animid + , b_animid_num + , b_animname + , b_birthgroup + , b_bgcertainty + , b_sex + , b_momid + , b_dadid + , b_dadid_publication_info + , b_firstborn + , b_birthdate + , b_bdmin + , b_bdmax + , b_bddist + , b_entrydate + , b_entrytype + , b_departdate + , b_departdateerror + , b_departtype) + VALUES ( + 'NONE' + , NULL + , 'NO FOCAL INDIVIDUAL' + , NULL + , 'U' + , 'U' + , NULL + , NULL + , NULL + , 'U' + , '1960-07-14' + , '1960-07-14' + , '1960-07-14' + , 'U' + , '1960-07-14' + , 'X' + , '2025-01-01' + , 0 + , 'X'); + -- -- Clean other biography rows -- diff --git a/db/schemas/sokwedb/tables/create/biography_data.m4 b/db/schemas/sokwedb/tables/create/biography_data.m4 index 2cb44d5..a128fa5 100644 --- a/db/schemas/sokwedb/tables/create/biography_data.m4 +++ b/db/schemas/sokwedb/tables/create/biography_data.m4 @@ -103,6 +103,7 @@ CREATE TABLE biography_data ( CHECK (entrydate <= departdate) CONSTRAINT "BDMin and DepartDate may not be more than sdb_max_lifespan years apart" CHECK ((animid = 'sdb_unk' + OR animid = 'sdb_no_focal' OR animid = 'sdb_stranger_male' OR animid = 'sdb_stranger_female' OR animid = 'sdb_stranger_female2' diff --git a/doc/src/tables/biography_data.m4 b/doc/src/tables/biography_data.m4 index 6bd378b..d158bdc 100644 --- a/doc/src/tables/biography_data.m4 +++ b/doc/src/tables/biography_data.m4 @@ -26,9 +26,11 @@ BIOGRAPHY_DATA .. |BIOGRAPHY_DATA_summary| replace:: Each row represents a chimpanzee. This table contains one row for - each chimpanzee on which data has ever been recorded (in SokweDB), - and an additional row for ``sdb_unk`` a generic value used when a - chimpanzee is unrecognized. + each chimpanzee on which data has ever been recorded (in SokweDB). + Additional rows exist for various codes used when a chimpanzee is + partially or entirely unidentified, such as ``sdb_unk`` or + ``sdb_stranger_female``. An additional ``sdb_no_focal`` row is used + when it does not make sense to record an individual. |BIOGRAPHY_DATA_summary| BIOGRAPHY_DATA contains the basic demographic data of individual chimpanzees. @@ -79,10 +81,10 @@ not be before the date the individual entered the study The maximum age of an individual, the time span between the individual's earliest possible birth date (|BIOGRAPHY_DATA.BDMin|) and their |BIOGRAPHY_DATA.DepartDate|, may not be more than sdb_max_lifespan -sdb_max_lifespan_units, unless the individual is one of the unknown -individuals, one with a |BIOGRAPHY_DATA.AnimID| of one of: -``sdb_unk``, ``sdb_stranger_male``, ``sdb_stranger_female``, -``sdb_stranger_female2``, or ``sdb_stranger_female3``. +sdb_max_lifespan_units, unless the |BIOGRAPHY_DATA.AnimID| is one of: +``sdb_unk``, ``sdb_no_focal``, ``sdb_stranger_male``, +``sdb_stranger_female``, ``sdb_stranger_female2``, or +``sdb_stranger_female3``. sdb_null_iff_null(*m4[|BIOGRAPHY_DATA.DadStatus|]m4*,*m4[|BIOGRAPHY_DATA.DadID|]m4*) sdb_null_iff_null(*m4[|BIOGRAPHY_DATA.DadIDPub|]m4*,*m4[|BIOGRAPHY_DATA.DadID|]m4*) @@ -106,7 +108,8 @@ AnimID (Animal IDentifier) `````````````````````````` .. |BIOGRAPHY_DATA.AnimID_summary| replace:: - A short sequence of characters which uniquely identifies the chimpanzee. + A short sequence of characters which uniquely identifies the chimpanzee, + or a code, like ``sdb_no_focal``, that has a special meaning to SokweDB. |BIOGRAPHY_DATA.AnimID_summary| |keycol| |cannot_change| diff --git a/doc/src/views/biography.m4 b/doc/src/views/biography.m4 index a72c681..f8ead70 100644 --- a/doc/src/views/biography.m4 +++ b/doc/src/views/biography.m4 @@ -31,8 +31,11 @@ BIOGRAPHY |BIOGRAPHY_summary| This view (like the underlying |BIOGRAPHY_DATA| table itself) contains one row for each chimpanzee on which data has -ever been recorded (in SokweDB), and an additional row for ``sdb_unk`` -a generic value used when a chimpanzee is unrecognized. +ever been recorded (in SokweDB). Additional rows exist for various +codes used when a chimpanzee is partially or entirely unidentified, +such as ``sdb_unk`` or ``sdb_stranger_female``. An additional +``sdb_no_focal`` row is used when it does not make sense to record an +individual. BIOGRAPHY contains the basic demographic data of individual chimpanzees. diff --git a/include/global_constants.m4 b/include/global_constants.m4 index d619315..faf4274 100644 --- a/include/global_constants.m4 +++ b/include/global_constants.m4 @@ -65,6 +65,8 @@ dnl dnl The unknown chimp define(`sdb_unk', `UNK') +dnl No focal or other watch-associated individual +define(`sdb_no_focal', `NONE') dnl Stranger male define(`sdb_stranger_male', `MGM') dnl Stranger female -- 2.34.1